package com.foreveross.proxyip.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.foreveross.proxyip.infra.base.ddd.domain.BaseEntity;


/**
 * The persistent class for the pi_source database table.
 * 
 */
@Entity
@Table(name="pi_channel")
public class ChannelEntity extends BaseEntity{
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;

	private String code;

	@Column(name="create_name")
	private String createName;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="create_time")
	private Date createTime;

	private String creator;

	@Column(name="flg_deleted")
	private Integer flgDeleted;

	@Column(name="is_valid")
	private Integer isValid;

	private String name;

	private Integer state;

	@Column(name="valid_default_url")
	private String validDefaultUrl;
	
	private String auth ; 
	
	
	@Column(name="handtailor_class")
	private String handtailorClass;
	
	@Column(name="last_time")
	private Date lastTime;

	private Double times;
	
	@Column(name="speed_grade")
	private Integer speedGrade;
	

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getCreateName() {
		return createName;
	}

	public void setCreateName(String createName) {
		this.createName = createName;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public Integer getFlgDeleted() {
		return flgDeleted;
	}

	public void setFlgDeleted(Integer flgDeleted) {
		this.flgDeleted = flgDeleted;
	}

	public Integer getIsValid() {
		return isValid;
	}

	public void setIsValid(Integer isValid) {
		this.isValid = isValid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public String getValidDefaultUrl() {
		return validDefaultUrl;
	}

	public void setValidDefaultUrl(String validDefaultUrl) {
		this.validDefaultUrl = validDefaultUrl;
	}
	
	
	
	public String getAuth() {
		return auth;
	}

	public void setAuth(String auth) {
		this.auth = auth;
	}
	
	

	public String getHandtailorClass() {
		return handtailorClass;
	}

	public void setHandtailorClass(String handtailorClass) {
		this.handtailorClass = handtailorClass;
	}
	

	public Date getLastTime() {
		return lastTime;
	}

	public void setLastTime(Date lastTime) {
		this.lastTime = lastTime;
	}

	public boolean isUsed(){
		if(this.flgDeleted==0&&this.state==1){
			return true;
		}
		return false;
	}
	
	
	
	public Double getTimes() {
		return times;
	}

	public void setTimes(Double times) {
		this.times = times;
	}
	
	

	public Integer getSpeedGrade() {
		return speedGrade;
	}

	public void setSpeedGrade(Integer speedGrade) {
		this.speedGrade = speedGrade;
	}

	public ChannelEntity cloneInstance(){
		ChannelEntity entity = new ChannelEntity();
		entity.setAuth(auth);
		entity.setCode(code);
		entity.setCreateName(createName);
		entity.setCreateTime(createTime);
		entity.setCreator(creator);
		entity.setFlgDeleted(flgDeleted);
		//entity.setId(entity);
		entity.setIsValid(isValid);
		entity.setName(name);
		entity.setState(state);
		entity.setValidDefaultUrl(validDefaultUrl);
		entity.setHandtailorClass(handtailorClass);
		entity.setLastTime(lastTime);
		entity.setTimes(times);
		entity.setSpeedGrade(speedGrade);
		return entity;
	}


}